<include file="public@head" />
</head>

<body>
    <div class="layui-fluid wrap js-check-wrap" id="component-tabs">
        <div class="layui-row">
            <div class="layui-col-md12">
                <div class="layui-card">
                    <div class="layui-card-header">文章分类</div>
                    <div class="layui-card-body">
                        <div class="layui-tab">
                            <ul class="layui-tab-title">
                                <li><a href="{:url('AdminCategory/index')}">分类管理</a></li>
                                <li><a href="{:url('AdminCategory/add')}">添加分类</a></li>
                                <li class="layui-this"><a href="{:url('AdminCategory/edit')}">编辑分类</a></li>
                            </ul>
                            <div class="layui-tab-content">
                                <form class="js-ajax-form layui-form" action="{:url('AdminCategory/editPost')}" method="post">
                                    <div class="layui-form-item">
                                        <label class="layui-form-label"><span style="color:#FF5722">*</span>上级</label>
                                        <div class="layui-input-block">
                                            <select name="parent_id" id="input-parent">
                                                <option value=" 0">作为一级分类</option>
                                                {$categories_tree}
                                            </select>
                                        </div>
                                    </div>
                                    <div class="layui-form-item">
                                        <label for="input-name" class="layui-form-label"><span style="color:#FF5722">*</span>分类名称</label>
                                        <div class="layui-input-block">
                                            <input type="text" name="name" required lay-verify="required" id="input-name" class="layui-input" value="{$name}">
                                        </div>
                                    </div>
                                    <div class="layui-form-item">
                                        <label for="input-alias" class="layui-form-label">分类别名</label>
                                        <div class="layui-input-block">
                                            <input type="text" name="alias" id="input-alias" class="layui-input" value="{$alias|default=''}">
                                        </div>
                                    </div>
                                    <div class="layui-form-item layui-form-text">
                                        <label for="input-description" class="layui-form-label">分类描述</label>
                                        <div class="layui-input-block">
                                            <textarea name="description" placeholder="请输入内容" class="layui-textarea" id="input-description">{$description}</textarea>
                                        </div>
                                    </div>
                                    <div class="layui-form-item">
                                        <label for="js-thumbnail-input" class="layui-form-label">缩略图</label>
                                        <div>
                                            <input type="hidden" name="more[thumbnail]" class="layui-input" id="js-thumbnail-input" value="{$more.thumbnail|default=''}">
                                            <div>
                                                <a href="javascript:uploadOneImage('图片上传','#js-thumbnail-input');">
                                                    <if condition="empty($more.thumbnail)">
                                                        <img src="__TMPL__/public/assets/images/default-thumbnail.png" id="js-thumbnail-input-preview" width="100" height="100" style="cursor: pointer" />
                                                        <else />
                                                        <img src="{:cmf_get_image_preview_url($more.thumbnail)}" id="js-thumbnail-input-preview" width="135" style="cursor: pointer" />
                                                    </if>
                                                </a>
                                            </div>
                                        </div>
                                    </div>
                                    <div class="layui-form-item">
                                        <label for="input-seo_title" class="layui-form-label">SEO标题</label>
                                        <div class="layui-input-block">
                                            <input type="text" id="input-seo_title" name="seo_title" class="layui-input" value="{$seo_title}">
                                        </div>
                                    </div>
                                    <div class="layui-form-item">
                                        <label for="input-seo_keywords" class="layui-form-label">SEO关键字</label>
                                        <div class="layui-input-block">
                                            <input type="text" id="input-seo_keywords" name="seo_keywords" class="layui-input" value="{$seo_keywords}">
                                        </div>
                                    </div>
                                    <div class="layui-form-item layui-form-text">
                                        <label for="input-seo_description" class="layui-form-label">SEO描述</label>
                                        <div class="layui-input-block">
                                            <textarea name="seo_description" id="input-seo_description" placeholder="请输入内容" class="layui-textarea">{$seo_description}</textarea>
                                        </div>
                                    </div>
                                    <div class="layui-form-item">
                                        <label for="input-list_tpl" class="layui-form-label"><span style="color:#FF5722">*</span>列表模板</label>
                                        <div class="layui-input-block">
                                            <select name="list_tpl" id="input-list_tpl">
                                                <foreach name="list_theme_files" item="vo">
                                                    <php>$value=preg_replace('/^portal\//','',$vo['file']);</php>
                                                    <option value="{$value}">{$vo.name} {$vo.file}.html</option>
                                                </foreach>
                                            </select>
                                        </div>
                                    </div>
                                    <div class="layui-form-item">
                                        <label for="input-one_tpl" class="layui-form-label"><span style="color:#FF5722">*</span>文章模板</label>
                                        <div class="layui-input-block">
                                            <select name="one_tpl" id="input-one_tpl">
                                                <foreach name="article_theme_files" item="vo">
                                                    <php>$value=preg_replace('/^portal\//','',$vo['file']);</php>
                                                    <option value="{$value}">{$vo.name} {$vo.file}.html</option>
                                                </foreach>
                                            </select>
                                        </div>
                                    </div>
                                    <div class="layui-form-item layui-layout-admin">
                                        <div class="layui-input-block">
                                            <div class="layui-footer" style="left: 0;">
                                                <input type="hidden" name="id" value="{$id}">
                                                <button type="submit" class="layui-btn js-ajax-submit" data-refresh="0">{:lang('SAVE')}</button>
                                                <a class="layui-btn layui-btn-primary" href="{:url('AdminCategory/index')}">{:lang('BACK')}</a>
                                            </div>
                                        </div>
                                    </div>
                                </form>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
    <include file="public@footer" />
    <script>
    layui.use('form', function() {
        var form = layui.form;
        $('#input-list_tpl').val("{$list_tpl|default=''}");
        $('#input-one_tpl').val("{$one_tpl|default=''}");
    });
    </script>
</body>

</html>